package ThreadDemo;

public class ThreadDemo07 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread() {
            @Override
            public void run() {
                while (!Thread.currentThread().isInterrupted()) {
                    System.out.println("别烦我，我正在转账");
//                    try {
//                        sleep(500);
//                    } catch (InterruptedException e) {
//                        e.printStackTrace();
//                        break;
//                    }
                }
                System.out.println("交易被终止");
            }
        };
        t.start();
//        Thread.sleep(1000);
        t.interrupt();
        System.out.println("对方是内鬼，终止交易!!!");
    }
}
